//
//  HJDGestationViewController.m
//  JYHospital
//
//  Created by 胡金东 on 16/5/13.
//  Copyright © 2016年 胡金东. All rights reserved.
//

#import "HJDGestationViewController.h"
#import "HJDFileViewController.h"


@interface HJDGestationViewController ()


@end

@implementation HJDGestationViewController


-(void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    self.navigationController.navigationBarHidden = NO;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"孕期档案";
    [self.navigationController.navigationBar setTitleTextAttributes:
     @{NSFontAttributeName:[UIFont systemFontOfSize:19],
       NSForegroundColorAttributeName:[UIColor getColorWithHexNumber:@"848484"]}];

    self.view.backgroundColor = [UIColor whiteColor];
    self.navigationItem.leftBarButtonItem = [UIBarButtonItem itemWithTarget:self action:@selector(backBtnClick) image:@"︿" HighImage:nil];

    [self setUpText];
  
    //添加手势
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(viewTapped:)];
    tap.cancelsTouchesInView = NO;
    [self.view addGestureRecognizer:tap];
    
}

//隐藏键盘
-(void)viewTapped:(UITapGestureRecognizer*)tap
{
    
    [self.view endEditing:YES];
    
}

//返回
-(void)backBtnClick{
    [self dismissViewControllerAnimated:YES completion:nil];
}

-(void)setUpText
{
    CGFloat lblX = HJDHorizontalMargin;
    CGFloat lblY = HJDNavigHeight + HJDVerticalMargin +HJDVerticalMargin/2;
    CGFloat lblW = 300;
    CGFloat lblH = HJDVerticalMargin;
    
    UILabel *lbl = [[UILabel alloc]initWithFrame:CGRectMake(lblX, lblY, lblW, lblH)];
    lbl.text = @"请和您的档案手机信息一致";
    lbl.textColor = [UIColor getColorWithHexNumber:@"5CC6AC"];
    lbl.font = [UIFont systemFontOfSize:14];
    [self.view addSubview:lbl];
    
    CGFloat phoneTextX = lblX;
    CGFloat phoneTextY = CGRectGetMaxY(lbl.frame)+HJDVerticalMargin;
    CGFloat phoneTextW = HJDWidth - HJDHorizontalMargin*2;
    CGFloat phoneTextH = 50;
    
    UITextField *phoneText = [[UITextField alloc]initWithFrame:CGRectMake(phoneTextX, phoneTextY, phoneTextW, phoneTextH)];
    phoneText.clearButtonMode = UITextFieldViewModeAlways;
    phoneText.placeholder = @"请输入手机号";
    [phoneText setValue:[UIFont systemFontOfSize:18] forKeyPath:@"_placeholderLabel.font"];
    [phoneText setValue:[UIColor getColorWithHexNumber:@"CFCFCF"] forKeyPath:@"_placeholderLabel.textColor"];
    phoneText.keyboardType = UIKeyboardTypeNumberPad;
    [phoneText setRadius:10 borderWith:1 borderColor:[UIColor getColorWithHexNumber:@"F1F1EE"]];
    
    phoneText.leftView = [[UIView alloc]initWithFrame:CGRectMake(5, 5, 25,50 )];
    phoneText.leftViewMode = UITextFieldViewModeAlways;
    UIImageView *image = [[UIImageView alloc]initWithFrame:CGRectMake(5, 10, 37/2, 58/2)];
    image.image = [UIImage imageNamed:@"档案手机"];
    [phoneText.leftView addSubview:image];

    [self.view addSubview:phoneText];
    
    
    CGFloat mesTestTextX = phoneTextX;
    CGFloat mesTestTextY = CGRectGetMaxY(phoneText.frame)+HJDVerticalMargin;
    CGFloat mesTestTextW = phoneTextW - 120;
    CGFloat mesTestTextH = 50;
    
    UITextField *mesTestText = [[UITextField alloc]initWithFrame:CGRectMake(mesTestTextX, mesTestTextY, mesTestTextW, mesTestTextH)];
    mesTestText.placeholder = @" 输入验证码";
    [mesTestText setValue:[UIFont systemFontOfSize:18] forKeyPath:@"_placeholderLabel.font"];
    [mesTestText setValue:[UIColor getColorWithHexNumber:@"CFCFCF"] forKeyPath:@"_placeholderLabel.textColor"];
    mesTestText.keyboardType = UIKeyboardTypeNumberPad;
    [mesTestText setRadius:10 borderWith:1 borderColor:[UIColor getColorWithHexNumber:@"F1F1EE"]];
    [self.view addSubview:mesTestText];
    
    CGFloat btnX = CGRectGetMaxX(mesTestText.frame)+5;
    CGFloat btnY = mesTestTextY;
    CGFloat btnW = 115;
    CGFloat btnH = mesTestTextH;
    
    UIButton *btn = [[UIButton alloc]initWithFrame:CGRectMake(btnX, btnY, btnW, btnH)];
    [btn setTitle:@"获取验证码" forState:UIControlStateNormal];
//    btn.titleLabel.font = [UIFont systemFontOfSize:18];
    [btn setRadius:10 borderWith:0 borderColor:nil];
    [btn setBackgroundColor:[UIColor getColorWithHexNumber:@"FF9EAC"]];
    [btn addTarget:self action:@selector(btnClick) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:btn];
    
    
    CGFloat seebtnX = HJDHorizontalMargin;
    CGFloat seebtnY = CGRectGetMaxY(btn.frame) + HJDVerticalMargin * 2;
    CGFloat seebtnW = phoneTextW;
    CGFloat seebtnH = 60;
    
    UIButton *seebtn = [[UIButton alloc]initWithFrame:CGRectMake(seebtnX, seebtnY, seebtnW, seebtnH)];
    [seebtn setTitle:@"查看档案" forState:UIControlStateNormal];
//    要失效
//    seebtn.font = [UIFont systemFontOfSize:19];
    seebtn.titleLabel.font = [UIFont systemFontOfSize:25];
    [seebtn setRadius:10 borderWith:0 borderColor:nil];
    [seebtn setBackgroundColor:[UIColor getColorWithHexNumber:@"5CC6AC"]];
    [seebtn addTarget:self action:@selector(seebtnClick) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:seebtn];
    

}

-(void)btnClick
{
    HJDLog(@"验证码");
}

-(void)seebtnClick
{
    HJDFileViewController *file = [[HJDFileViewController alloc]init];
    [self.navigationController pushViewController:file animated:YES];
}


@end
